<%@ Register TagPrefix="ignav" Namespace="Infragistics.WebUI.UltraWebNavigator" Assembly="Infragistics2.WebUI.UltraWebNavigator.v6.1, Version=6.1.20061.1094, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %>
<%@ Register TagPrefix="igtbl" Namespace="Infragistics.WebUI.UltraWebGrid" Assembly="Infragistics2.WebUI.UltraWebGrid.v6.1, Version=6.1.20061.1094, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %>

<%@ Page Language="c#" Codebehind="CustomizeQuote2.aspx.cs" AutoEventWireup="True"
   Inherits="QuoteAdvantage.CustomizeQuote2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <title>Customize Quote</title>
   <link href="QuoteAdvantageStyles.css" type="text/css" rel="stylesheet" />
   <style type="text/css">
        html, body
        {
            height: 100%;
            margin: 0;
            padding: 0;
            border: none;
        }
    </style>

   <script type="text/javascript">
      function onFormLoad()
      {
      }

      function addItem(strProductId)
      {
         document.Form1.txtProductId.value = strProductId;
         __doPostBack("btnAddItem", "");
         return false;            
      }
      
      function removeItem(strProductId)
      {
         document.Form1.txtProductId.value = strProductId;
         __doPostBack("btnRemoveItem", "");
         return false;            
      }
         
      function customizeItem(strUrl)
      {
         var ctlTree = igtree_getTreeById("ctlTree");
         var selectedNode = ctlTree.getSelectedNode();
         var strTag = selectedNode.getTag();
         document.location = strUrl + "&CategoryId=" + strTag;
         return false;            
      }          
      
      function onPrintClicked()
      {
         window.open("PrintQuote.aspx?QuoteId=<%=objQuote.QuoteId%>", "print", "height=640,width=618,status=0,toolbar=0,menubar=0,scrollbars=1");
         return false;
      }
      
      
      var txtEditControl;
      var lblEditControl;
      var strEditMode = "";
      
      function onQtyClick(strTextControlName, strLabelControlName, strQuoteDetailId)
      {
         startEdit(strTextControlName, strLabelControlName, strQuoteDetailId, "btnEditQty");
      }  
    
      function onMultiplierClick(strTextControlName, strLabelControlName, strQuoteDetailId)
      {
         startEdit(strTextControlName, strLabelControlName, strQuoteDetailId, "btnEditMultiplier");
      }  
      
      function onPercentDiscountClick(strTextControlName, strLabelControlName, strQuoteDetailId)
      {
         startEdit(strTextControlName, strLabelControlName, strQuoteDetailId, "btnEditPercentDiscount");
      }  
       
      function onPercentMarkupClick(strTextControlName, strLabelControlName, strQuoteDetailId)
      {
         startEdit(strTextControlName, strLabelControlName, strQuoteDetailId, "btnEditPercentMarkup");
      } 
                  
      function onFormKey(e)
      {
         var bResult = true;
         
         if (e.keyCode == 13)
         {
             bResult = false;                
             endEdit();
        }
        
        return bResult;
      }  
     
      function startEdit(strTextControlName, strLabelControlName, strQuoteDetailId, strNewEditMode)
      {
         var txt = document.getElementById(strTextControlName);
         var lbl = document.getElementById(strLabelControlName);
         
         if (txt != txtEditControl && txt != null)
         {
             endEdit();
             txtEditControl = txt;
             lblEditControl = lbl;
             txtEditControl.style.visibility = "visible";
             txtEditControl.select();
             lblEditControl.style.visibility = "hidden";
             var txtProductId = document.getElementById("txtProductId");
             txtProductId.value = strQuoteDetailId;
             strEditMode = strNewEditMode; 
         }
      }           
     
      function endEdit()
      {
         if (txtEditControl != null)
         {
             lblEditControl.style.visibility = "visible";
             txtEditControl.style.visibility = "hidden";
             
             if (txtEditControl.value != lblEditControl.innerText)
             {
                 var txtValue = document.getElementById("txtValue");
                 txtValue.value = txtEditControl.value;   
                 lblEditControl.innerText = "(updating...)";             
                 __doPostBack(strEditMode, "");
             }
             
             lblEditControl = null;
             txtEditControl = null;
         }
      }
        
   </script>

</head>
<body class="QuoteAdvantagePage" onload="onFormLoad()" style="margin: 0px; height: 100%; border: solid 0px yellow; padding: 0px"
   onkeydown="return onFormKey(event)">
   <form id="Form1" method="post" runat="server">
      <table style="width: 100%; top: 0px; height: 98%; border: solid 0px blue;" cellpadding="0" cellspacing="0">
         <tr>
            <td style="width: 280px; height: 98%; border: solid 0px green; vertical-align: top"
               rowspan="2">
               <table style="height: 97%; width:100%">
                  <tr>
                     <td style="height:20px" valign="top">
                        <asp:Label ID="lblProductCategories" runat="server" Width="160px" CssClass="Header">Product Categories</asp:Label>
                     </td>
                  </tr>
                  <tr>
                     <td style="height:97%" valign="top">
                        <ignav:UltraWebTree ID="ctlTree" runat="server" Width="280px" Height="50%" ImageDirectory="/ig_common/images/"
                           BackColor="White" BorderColor="DarkGray" BorderStyle="Solid" BorderWidth="1px"
                           CollapseImage="ig_treeXPMinus.gif" DefaultImage="ig_treeXPFolderClosed.gif" Cursor="Default"
                           WebTreeTarget="HierarchicalTree" Indentation="20" ExpandImage="ig_treeXPPlus.gif"
                           DefaultSelectedImage="ig_treeXPFolderOpen.gif" Font-Names="Tahoma" Font-Size="8pt">
                           <HoverNodeStyle Font-Underline="True" ForeColor="DarkBlue"></HoverNodeStyle>
                           <SelectedNodeStyle ForeColor="White" BackColor="#316AC5">
                              <Padding Bottom="2px" Left="2px" Top="2px" Right="2px"></Padding>
                           </SelectedNodeStyle>
                           <NodePaddings Bottom="1px" Left="1px" Top="1px" Right="1px"></NodePaddings>
                           <Levels>
                              <ignav:Level Index="0"></ignav:Level>
                              <ignav:Level Index="1"></ignav:Level>
                           </Levels>
                        </ignav:UltraWebTree>
                         <asp:TreeView ID="ctlTree2" runat="server" Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black" Height="50%" Width="280px">
                            <NodeStyle HorizontalPadding="4px" ImageUrl="~/images/FolderClosed.gif" />
               </asp:TreeView>
                     </td>
                  </tr>
               </table>
              
            </td>
            <td valign="top" style="height: 45%">
               <table style="width: 100%; height: 100%; border: solid 0px red">
                  <tr>
                     <td style="width: 100%; height: 20px">
                        <table style="width: 100%">
                           <tr>
                              <td>
                                 <asp:Label ID="lblAvailableItemsInCategory" runat="server" CssClass="Header" Width="100%">Available Items in Category:</asp:Label>
                              </td>
                              <td style="width: 80px; text-align: right">
                                 <asp:ImageButton ID="btnDiscount" runat="server" ImageUrl="CustomDiscount.gif" ToolTip="Discounting">
                                 </asp:ImageButton>
                                 <asp:ImageButton ID="btnPrint" runat="server" ToolTip="Generate Proposal" ImageUrl="Print.gif">
                                 </asp:ImageButton>
                                 <a href="Support.aspx" target="_blank" style="padding-left: 4px">
                                    <img class="ImageLink" id="imgLogo" title="QuoteAdvantage Support" height="15" alt=""
                                       src="QuoteAdvantageSmall.gif" width="14" /></a>
                              </td>
                           </tr>
                        </table>
                     </td>
                  </tr>
                  <tr>
                     <td valign="top" style="width: 100%; height: 100%; padding-right: 4px;">
                        <div class="ScrollingGrid" style="height: 100%; border: solid 0px green">
                           <asp:GridView ID="gridAvailableProducts3" runat="server" CellPadding="4" ForeColor="#333333"
                              GridLines="None" AutoGenerateColumns="False" Width="100%" Font-Names="Tahoma"
                              Font-Size="8.5pt" UseAccessibleHeader="False" OnRowDataBound="gridAvailableProducts3_RowDataBound"
                              BorderStyle="None">
                              <RowStyle CssClass="GridViewRow" Height="20px" />
                              <FooterStyle BackColor="#507CD1" ForeColor="White" />
                              <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                              <SelectedRowStyle BackColor="#D1DDF1" ForeColor="#333333" />
                              <HeaderStyle ForeColor="Black" HorizontalAlign="Left" />
                              <EditRowStyle BackColor="#2461BF" />
                              <AlternatingRowStyle BackColor="White" />
                              <Columns>
                                 <asp:TemplateField>
                                    <ItemTemplate>
                                       <asp:HyperLink ID="lnkAdd" runat="server" NavigateUrl="" Text="Add"></asp:HyperLink>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="GridViewHeader" />
                                    <ItemStyle CssClass="GridViewRow" />
                                 </asp:TemplateField>
                                 <asp:BoundField HeaderText="Name" DataField="Name">
                                    <HeaderStyle CssClass="GridViewHeader" />
                                    <ItemStyle CssClass="GridViewRow" />
                                 </asp:BoundField>
                                 <asp:BoundField HeaderText="Product ID" DataField="ProductNumber">
                                    <HeaderStyle CssClass="GridViewHeader" />
                                    <ItemStyle CssClass="GridViewRow" />
                                 </asp:BoundField>
                                 <asp:BoundField DataField="StandardCost" HeaderText="Standard Cost">
                                    <HeaderStyle CssClass="GridViewHeader" />
                                    <ItemStyle CssClass="GridViewRow" />
                                 </asp:BoundField>
                                 <asp:BoundField DataField="ListPrice" HeaderText="List Price">
                                    <HeaderStyle CssClass="GridViewHeader" />
                                    <ItemStyle CssClass="GridViewRow" />
                                 </asp:BoundField>
                                 <asp:BoundField DataField="Price" HeaderText="Price">
                                    <HeaderStyle CssClass="GridViewHeader" />
                                    <ItemStyle CssClass="GridViewRow" />
                                 </asp:BoundField>
                              </Columns>
                           </asp:GridView>
                        </div>
                     </td>
                  </tr>
               </table>
            </td>
         </tr>
         <tr>
            <td valign="top" style="height: 45%">
               <table style="width: 100%; height: 100%; border: solid purple 0px">
                  <tr>
                     <td style="height: 20px">
                        <asp:Label ID="lblCustomizableProducts" runat="server" CssClass="Header" Width="208px">Customizable Products on Quote</asp:Label>
                     </td>
                  </tr>
                  <tr>
                     <td valign="top" style="width: 100%; height: 100%; padding-right: 4px;">
                        <div class="ScrollingGrid" style="height: 100%">
                           <asp:GridView ID="gridQuoteItems3" runat="server" CellPadding="4" ForeColor="#333333"
                              GridLines="None" AutoGenerateColumns="False" Width="100%" Font-Names="Tahoma"
                              Font-Size="8.5pt" UseAccessibleHeader="False" OnRowDataBound="gridQuoteItems3_RowDataBound"
                              BorderStyle="None">
                              <RowStyle CssClass="GridViewRow" />
                              <FooterStyle BackColor="#507CD1" ForeColor="White" />
                              <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                              <SelectedRowStyle BackColor="#D1DDF1" ForeColor="#333333" />
                              <HeaderStyle ForeColor="Black" HorizontalAlign="Left" />
                              <EditRowStyle BackColor="#2461BF" />
                              <AlternatingRowStyle BackColor="White" />
                              <Columns>
                                 <asp:TemplateField HeaderText="Name">
                                    <ItemTemplate>
                                       <asp:HyperLink ID="lnkCustomize" runat="server" NavigateUrl="" Text="Customize"></asp:HyperLink>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="GridViewHeader" />
                                    <ItemStyle CssClass="GridViewRow" />
                                 </asp:TemplateField>
                                 <asp:BoundField HeaderText="Custom 1" DataField="ProductCustomField1">
                                    <HeaderStyle CssClass="GridViewHeader" />
                                    <ItemStyle CssClass="GridViewRow" />
                                 </asp:BoundField>
                                 <asp:BoundField HeaderText="Base Price" DataField="PricePerUnit">
                                    <HeaderStyle CssClass="GridViewHeader" />
                                    <ItemStyle CssClass="GridViewRow" />
                                 </asp:BoundField>
                                 <asp:TemplateField HeaderText="Qty">
                                    <ItemTemplate>
                                       <div style="position: relative; border: none; height: 100%; width: 100%; height: 17px">
                                          <asp:TextBox ID="txtQty" runat="server" Style="position: absolute; left: 0px; top: 0px;
                                             height: 14px; visibility: hidden; font-size: 8.0pt; font-family: Tahoma; text-align: right;"
                                             Text='<%# Bind("Quantity") %>' Width="80%"></asp:TextBox>
                                          <asp:Label ID="lblQty" runat="server" Style="position: absolute; left: 0px; top: 2px;
                                             text-align: right; visibility: visible" Width="80%" Text='<%# Bind("Quantity") %>'></asp:Label>
                                       </div>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="GridViewHeader" />
                                    <ItemStyle BackColor="PaleTurquoise" CssClass="GridViewRow" Wrap="False" />
                                 </asp:TemplateField>
                                 <asp:TemplateField HeaderText="Discount">
                                    <ItemTemplate>
                                       <div style="position: relative; border: none; height: 100%; width: 100%; height: 17px">
                                          <asp:TextBox ID="txtMultiplier" runat="server" Style="position: absolute; left: 0px;
                                             top: 0px; height: 14px; visibility: hidden; font-size: 8.0pt; font-family: Tahoma;
                                             text-align: right;" Text="" Width="80%"></asp:TextBox>
                                          <asp:Label ID="lblMultiplier" runat="server" Style="position: absolute; left: 0px;
                                             top: 2px; text-align: right; visibility: visible" Width="80%" Text=""></asp:Label>
                                       </div>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="GridViewHeader" />
                                    <ItemStyle BackColor="PaleTurquoise" CssClass="GridViewRow" Wrap="False" />
                                 </asp:TemplateField>
                                 <asp:TemplateField HeaderText="Discount %">
                                    <ItemTemplate>
                                       <div style="position: relative; border: none; height: 100%; width: 100%; height: 17px">
                                          <asp:TextBox ID="txtPercentDiscount" runat="server" Style="position: absolute; left: 0px;
                                             top: 0px; height: 14px; visibility: hidden; font-size: 8.0pt; font-family: Tahoma;
                                             text-align: right;" Text="" Width="80%"></asp:TextBox>
                                          <asp:Label ID="lblPercentDiscount" runat="server" Style="position: absolute; left: 0px;
                                             top: 2px; text-align: right; visibility: visible" Width="80%" Text=""></asp:Label>
                                       </div>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="GridViewHeader" />
                                    <ItemStyle BackColor="PaleTurquoise" CssClass="GridViewRow" Wrap="False" />
                                 </asp:TemplateField>
                                 <asp:TemplateField HeaderText="Markup %">
                                    <ItemTemplate>
                                       <div style="position: relative; border: none; height: 100%; width: 100%; height: 17px">
                                          <asp:TextBox ID="txtPercentMarkup" runat="server" Style="position: absolute; left: 0px;
                                             top: 0px; height: 14px; visibility: hidden; font-size: 8.0pt; font-family: Tahoma;
                                             text-align: right;" Text="" Width="80%"></asp:TextBox>
                                          <asp:Label ID="lblPercentMarkup" runat="server" Style="position: absolute; left: 0px;
                                             top: 2px; text-align: right; visibility: visible" Width="80%" Text=""></asp:Label>
                                       </div>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="GridViewHeader" />
                                    <ItemStyle BackColor="PaleTurquoise" CssClass="GridViewRow" Wrap="False" />
                                 </asp:TemplateField>
                                 <asp:BoundField DataField="ProductCustomField2" HeaderText="Custom 2">
                                    <HeaderStyle CssClass="GridViewHeader" />
                                 </asp:BoundField>
                                 <asp:BoundField HeaderText="Customized&lt;br/&gt; Price" HtmlEncode="False">
                                    <HeaderStyle CssClass="GridViewHeader" />
                                 </asp:BoundField>
                                 <asp:TemplateField>
                                    <ItemTemplate>
                                       <asp:HyperLink ID="lnkRemove" runat="server" NavigateUrl="" Text="Remove"></asp:HyperLink>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="GridViewHeader" />
                                    <ItemStyle CssClass="GridViewRow" />
                                 </asp:TemplateField>
                                 <asp:ButtonField CommandName="SingleClick" Text="Click" Visible="False" />
                              </Columns>
                           </asp:GridView>
                        </div>
                     </td>
                  </tr>
               </table>
            </td>
         </tr>
      </table>
      <asp:Button ID="btnRemoveItem" Style="left: 0px; visibility: hidden; position: absolute;
         top: 0px" runat="server" Text="Remove" OnClick="btnRemoveItem_Click"></asp:Button>
      <asp:Button ID="btnAddItem" Style="left: 0px; visibility: hidden; position: absolute;
         top: 0px" runat="server" Text="Add" OnClick="btnAddItem_Click"></asp:Button>
      <asp:Button ID="btnEditQty" Style="left: 0px; visibility: hidden; position: absolute;
         top: 0px" runat="server" Text="Edit Qty" OnClick="btnEditQty_Click"></asp:Button>
      <asp:Button ID="btnEditMultiplier" Style="left: 0px; visibility: hidden; position: absolute;
         top: 0px" runat="server" Text="Edit Multiplier" OnClick="btnEditMultiplier_Click">
      </asp:Button>
      <asp:Button ID="btnEditPercentDiscount" Style="left: 0px; visibility: hidden; position: absolute;
         top: 0px" runat="server" Text="Edit Multiplier" OnClick="btnEditPercentDiscount_Click">
      </asp:Button>
      <asp:Button ID="btnEditPercentMarkup" Style="left: 0px; visibility: hidden; position: absolute;
         top: 0px" runat="server" Text="Edit Multiplier" OnClick="btnEditPercentMarkup_Click">
      </asp:Button>
      <asp:TextBox ID="txtProductId" Style="left: 0px; visibility: hidden; position: absolute;
         top: 0px" runat="server" Width="120px"></asp:TextBox>
      <asp:TextBox ID="txtValue" Style="left: 0px; visibility: hidden; position: absolute;
         top: 0px" runat="server" Width="120px"></asp:TextBox>
   </form>
</body>
</html>
